package com.corechina.apex_osswords.controller;


import com.corechina.apex_osswords.common.Response;
import com.corechina.apex_osswords.common.SysLog;
import com.corechina.apex_osswords.domain.entity.CorePolling;
import com.corechina.apex_osswords.service.ICorePollingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 巡检表 前端控制器
 * </p>
 *
 * @author cc
 * @since 2023-03-10
 */

@Api(tags = "巡检管理①")
@RestController
@RequestMapping("/core/polling")
public class CorePollingController {

    @Autowired
    private ICorePollingService iCorePollingService;

    @ApiOperation("新增")
    @SysLog("新增巡检")
    @PostMapping("/add")
    public Response add(@RequestBody CorePolling corePolling) {
        return iCorePollingService.add(corePolling);
    }

    @ApiOperation("编辑")
    @SysLog("编辑巡检")
    @PutMapping("/update")
    public Response update(@RequestBody CorePolling corePolling) {
        return iCorePollingService.update(corePolling);
    }

    @ApiOperation("删除")
    @SysLog("删除巡检")
    @DeleteMapping("/del")
    public Response del(Integer id) {
        return iCorePollingService.del(id);
    }

    @ApiOperation("列表")
    @GetMapping("/getList")
    public Response getList(String name, Integer projectId, Integer planPerson, Integer type, Integer pageIndex, Integer pageSize) {
        return iCorePollingService.getList(name, projectId, planPerson, type, pageIndex, pageSize);
    }

    @ApiOperation("详情")
    @GetMapping("/getOne")
    public Response getOne(Integer id) {
        return Response.ok(iCorePollingService.getById(id));
    }

}

